package org.bigjava.mapper;

import org.apache.ibatis.annotations.*;
import org.bigjava.bean.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository("tzggMapper")
public interface TzggMapper {

    //根据标题或者内容搜索公告
    @Select("select * from tzgg where jsc=1 and title like '%' #{title} '%' and content like '%' #{content} '%'")
    public List<Tzgg> tzggSouSuo(String title,String content);
    //修改公告
    @Update("update tzgg set title=#{title},content=#{content},fbsj=#{fbsj} where id=#{id}")
    public int tzggXiuGai(Tzgg tzgg);
    //发布公告
    @Insert("insert into tzgg(title,content,fbsj) values (#{title},#{content},#{fbsj})")
    public int tzggAdd(Tzgg tzgg);
    //根据id假删除业主
    @Update("update tzgg set jsc=0 where id=#{id}")
    public int tzggShanChu(int id);
    //根据id查询公告信息
    @Select("select * from tzgg where id = #{id}")
    public Tzgg tzggId(int id);
    //公告总数
    @Select("select count(*) from tzgg where jsc=1")
    public int tzggZong();
    //分页查询公告信息
    @Select("select * from tzgg where jsc=1 limit #{offset},#{length}")
    public List<Tzgg> tzggFenYe(int offset , int length);
}
